home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / Phrack / Phrack Issue 51.sit / Phrack51 / P51-07 < prev    next >
Text File  |  1997-09-01  |  11KB  |  352 lines

  1. ---[  Phrack Magazine   Volume 7, Issue 51 September 01, 1997, article 07 of 17
  2.  
  3.  
  4. -------------------------[  Juggernaut 1.2 update
  5.  
  6.  
  7. --------[  route <route@infonexus.com>
  8.                                          
  9.  
  10.  
  11.     Well, Juggernaut went out, and the bug reports came in...  
  12. Juggernaut, the robust network tool for Linux, originally went out in Phrack 
  13. 50.  This patchfile updates Juggernaut 1.0 (the version in P50-06) to version 
  14. 1.2.  It offers the following:
  15.  
  16.     - Nonfunctional things like nomenclature and cosmetics.
  17.     - The IFF_PROMISC flag is unset upon exit.  Previously the program would 
  18.       leave the network interface in promiscuous mode.
  19.     - We no longer are interested in HTTP connections (unless -DGREED is 
  20.       defined).
  21.     - Connection Spying now works properly.
  22.     - Connection RSTing and Automated connection RSTing now work better.
  23.  
  24.  
  25.         Please keep the bug reports coming in!
  26.  
  27.     To extract this patchfile, use the included extraction utility to remove 
  28. the patchfile from the article.  Then simply copy it into the Juggernaut 
  29. directory and `patch <  juggernaut_1.0-1.2_patch`
  30.  
  31. <++> juggernaut_1.0-1.2_patch
  32.  
  33. --- NumberOneCrush/main.c    Thu May  8 15:37:02 1997
  34. +++ NumberOneCrush/main.c    Fri Jun  6 01:33:42 1997
  35. @@ -1,7 +1,7 @@
  36.  /*
  37.   *
  38.   *                        Juggernaut
  39. - *                    Version b2
  40. + *                    Version 1.2
  41.   *
  42.   *                            1996/7 Guild productions
  43.   *                 daemon9[guild|phrack|r00t]
  44. @@ -42,7 +42,7 @@
  45.  #define DEVICE "eth0"
  46.  #define LOGFILE "./juggernaut.log.spy"
  47.  
  48. -char version[]="1.0\0";
  49. +char version[]="1.2";
  50.  int sigsentry=1;            /* Signal sentry */
  51.  int ripsock=0;                /* RIP socket */
  52.  int linksock=0;                /* SOCK PACKET socket */
  53. @@ -96,8 +96,8 @@
  54.      char buf[MINIBUF]={0};
  55.      char token[2*MINIBUF]={0};
  56.      int c;
  57. -                                
  58. -    if(geteuid()||getuid()){                /* r00t? */
  59. +
  60. +    if(geteuid()||getuid()){                /* r00t? */
  61.          fprintf(stderr,"UID or EUID of 0 needed...\n");
  62.          exit(0);
  63.          }
  64. @@ -279,7 +279,7 @@
  65.          fgets(buf,sizeof(buf),stdin);
  66.          if(buf[0]==0x0a||buf[0]=='q')return;
  67.          if(!(int)(val=atoi(buf)))continue;
  68. -        if(!(target=checkc(val)))fprintf(stderr,"Connection not in queue.\n");    
  69. +        if(!(target=checkc(val)))fprintf(stderr,"Connection not in database.\n");
  70.          else break;
  71.      }
  72.      fprintf(stderr,"\nDo you wish to log to a file as well? [y/N] >");
  73. @@ -324,7 +324,7 @@
  74.      fgets(buf,sizeof(buf),stdin);
  75.      if(buf[0]==0x0a||buf[0]=='q')return;
  76.         if(!(int)(val=atoi(buf)))continue;
  77. -    if(!(target=checkc(val)))fprintf(stderr,"Connection not in queue.\n");
  78. +    if(!(target=checkc(val)))fprintf(stderr,"Connection not in database.\n");
  79.      else break;
  80.      }
  81.      signal(SIGINT,convulsion);
  82. @@ -440,7 +440,7 @@
  83.  
  84.      fprintf(stderr,"Juggernaut %s route@infonexus.com [guild 1996/7]\n",version);
  85.  
  86. -    fprintf(stderr,"\nJuggernaut compiled with the following options:\n");
  87. +    fprintf(stderr,"\nBuilt on %s %s with the following options:\n",__DATE__,__TIME__);
  88.  #ifdef MULTI_P
  89.      fprintf(stderr," Multi-processing\n");
  90.  #endif
  91. @@ -501,7 +501,7 @@
  92.          fgets(buf,sizeof(buf),stdin);
  93.          if(buf[0]==0x0a||buf[0]=='q')return;
  94.          if(!(int)(val=atoi(buf)))continue;
  95. -        if(!(target=checkc(val)))fprintf(stderr,"Connection not in queue.\n");    
  96. +        if(!(target=checkc(val)))fprintf(stderr,"Connection not in database.\n");
  97.          else break;
  98.      }
  99.      if(ntohs(target->dport)!=23){
  100. @@ -547,7 +547,7 @@
  101.          fgets(buf,sizeof(buf),stdin);
  102.          if(buf[0]==0x0a||buf[0]=='q')return;
  103.          if(!(int)(val=atoi(buf)))continue;
  104. -        if(!(target=checkc(val)))fprintf(stderr,"Connection not in queue.\n");    
  105. +        if(!(target=checkc(val)))fprintf(stderr,"Connection not in database.\n");
  106.          else break;
  107.      }
  108.      if(ntohs(target->dport)!=23){
  109. --- NumberOneCrush/mem.c    Thu May  8 15:37:02 1997
  110. +++ NumberOneCrush/mem.c    Fri Jun  6 01:33:09 1997
  111. @@ -1,7 +1,7 @@
  112.  /*
  113.   *
  114.   *                                  Juggernaut
  115. - *                                  Version b1
  116. + *                                  Version 1.2
  117.   *
  118.   *                            1996/7 Guild productions
  119.   *                           daemon9[guild|phrack|r00t]
  120. --- NumberOneCrush/menu.c    Thu May  8 15:37:02 1997
  121. +++ NumberOneCrush/menu.c    Fri Jun  6 01:33:32 1997
  122. @@ -1,7 +1,7 @@
  123.  /*
  124.   *
  125.   *                                  Juggernaut
  126. - *                                  Version b2
  127. + *                                  Version 1.2
  128.   *
  129.   *                            1996/7 Guild productions
  130.   *                           daemon9[guild|phrack|r00t]
  131. --- NumberOneCrush/net.c    Thu May  8 15:37:02 1997
  132. +++ NumberOneCrush/net.c    Fri Jun  6 01:32:56 1997
  133. @@ -1,7 +1,7 @@
  134.  /*
  135.   *
  136.   *                                  Juggernaut
  137. - *                                  Version b1
  138. + *                                  Version 1.2
  139.   *
  140.   *                            1996/7 Guild productions
  141.   *                           daemon9[guild|phrack|r00t]
  142. @@ -92,13 +92,14 @@
  143.   *  mode.
  144.   */
  145.  
  146. -int tap(device)
  147. +int tap(device,mode)
  148.  char *device;
  149. +int mode;
  150.  {
  151.      
  152.      int fd;                
  153.      struct ifreq ifr;   /* Link-layer interface request structure */
  154. -                        /* Ethernet code for IP 0x800==ETH_P_IP */
  155. +                        /* Ethernet code for IP 0x0800==ETH_P_IP */
  156.      if((fd=socket(AF_INET,SOCK_PACKET,htons(ETH_P_IP)))<0){    
  157.          if(verbosity)perror("(tap) SOCK_PACKET allocation problems [fatal]");
  158.          exit(1);                               
  159. @@ -109,16 +110,22 @@
  160.          close(fd);
  161.            exit(1);
  162.      }
  163. -    ifr.ifr_flags|=IFF_PROMISC;                /* Set promiscuous mode */
  164. +    if(!mode)ifr.ifr_flags^=IFF_PROMISC;    /* Unset promiscuous mode */
  165. +    else ifr.ifr_flags|=IFF_PROMISC;        /* Set promiscuous mode */
  166.      if((ioctl(fd,SIOCSIFFLAGS,&ifr))<0){    /* Set flags */
  167. -        if(verbosity)perror("(tap) Can't set promiscuous mode [fatal]");
  168. +        if(verbosity)perror("(tap) Can't set/unset promiscuous mode [fatal]");
  169.          close(fd);
  170.      exit(1);
  171.      }
  172. -    return(fd);
  173. +    if(!mode){
  174. +        close(fd);
  175. +        return(0);
  176. +    }
  177. +    else return(fd);
  178.  }
  179.  
  180.  
  181. +
  182.  /*
  183.   *  Gimme a raw-IP socket.  Use of IP_HDRINCL is automatic with 2.0.x
  184.   *  kernels.  Not sure about 1.2.x
  185. @@ -197,7 +204,6 @@
  186.          case 22:
  187.          case 23:
  188.          case 25:
  189. -        case 80:
  190.          case 513:
  191.          case 6667:
  192.              if(((int)msg=addc(iphp,tcphp)))if(verbosity)fprintf(stderr,"%c%s",0x08,msg);
  193. @@ -235,7 +241,6 @@
  194.          case 22:
  195.          case 23:
  196.          case 25:
  197. -        case 80:
  198.          case 513:
  199.          case 6667:
  200.              if(((int)msg=delc(iphp,tcphp)))if(verbosity)fprintf(stderr,"%c%s",0x08,msg);
  201. @@ -261,7 +266,7 @@
  202.      void dumpp(char *,int,FILE *);
  203.  
  204.      extern int sigsentry;
  205. -    int tlinksock=tap(DEVICE);    /* Spying tap.  XXX- Really dumb way to do this... */
  206. +    int tlinksock=tap(DEVICE,1);    /* Spying tap.  XXX- Really dumb way to do this... */
  207.      time_t tp;
  208.  
  209.      ALIGNNETPOINTERS();
  210. @@ -272,20 +277,14 @@
  211.          time(&tp);
  212.          fprintf(fp,": Log started:\t\t%s---------------------------------------------------------------------\n",ctime(&tp));
  213.      }
  214. -            /* NO alaram timeout here.  SIGINT kills our spy session */
  215. -    while(sigsentry)if(recv(tlinksock,&epack,sizeof(epack),0))if(iphp->protocol==IPPROTO_TCP)if(iphp->saddr==target->daddr&&tcphp->source==target->dport)dumpp(epack.payload-2,htons(iphp->tot_len)-sizeof(epack.ip)-sizeof(epack.tcp),fp);
  216. +            /* NO alarm timeout here.  SIGINT kills our spy session */
  217. +    while(sigsentry)if(recv(tlinksock,&epack,sizeof(epack),0))if(iphp->protocol==IPPROTO_TCP)if(iphp->saddr==target->daddr && iphp->daddr==target->saddr && tcphp->dest==target->sport)dumpp(epack.payload-2,htons(iphp->tot_len)-sizeof(epack.ip)-sizeof(epac
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. k
  227. +
  228. +.tcp),fp);
  229.      
  230.      if(fp){
  231.          fprintf(fp,"\n---------------------------------------------------------------------\n: Juggernaut connection spy log trailer\n: %s [%d]\t-->\t %s [%d]\n",hostLookup(target->saddr),ntohs(target->sport),hostLookup(target->daddr),ntohs(target->dport
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240. )
  241.  
  242. -
  243. -
  244. -
  245. -
  246. -
  247. -
  248. -
  249. -
  250.  );
  251.          time(&tp);
  252.          fprintf(fp,": Log ended:\t\t%s---------------------------------------------------------------------\n",ctime(&tp));
  253. @@ -347,8 +346,8 @@
  254.          unsigned short tlen;
  255.      }*ppheader;
  256.           
  257. -    static int moot=0;
  258. -    int tlinksock=tap(DEVICE);
  259. +    int moot=0;
  260. +    int tlinksock=tap(DEVICE,1);
  261.  
  262.      ALIGNNETPOINTERS();
  263.  
  264. @@ -451,7 +450,7 @@
  265.      extern int ripsock;    
  266.      extern int acrstpid;
  267.      char *tempBuf=0;
  268. -    int tlinksock=tap(DEVICE);
  269. +    int tlinksock=tap(DEVICE,1);
  270.  
  271.      switch((acrstpid=fork())){     /* Drop a child to backround, return the 
  272.                                     parent to continue */
  273. @@ -570,7 +569,7 @@
  274.      extern int netreadtimeout;
  275.      static int len;
  276.      char *tempBuf;
  277. -    int tlinksock=tap(DEVICE);
  278. +    int tlinksock=tap(DEVICE,1);
  279.  
  280.      ALIGNNETPOINTERS();
  281.  
  282. @@ -675,7 +674,7 @@
  283.      extern int netreadtimeout;
  284.      extern int sigsentry;
  285.      static int len;
  286. -    int tlinksock=tap(DEVICE);            
  287. +    int tlinksock=tap(DEVICE,1);            
  288.      
  289.      ALIGNNETPOINTERS();
  290.  
  291. @@ -799,7 +798,7 @@
  292.      int grabflag=0;                     /* Time to grab some packets */
  293.      unsigned long targetsourceip=0;
  294.      unsigned short targetsourceport=0;
  295. -    int tlinksock=tap(DEVICE);          
  296. +    int tlinksock=tap(DEVICE,1);          
  297.  
  298.      if(!(fp=fopen(SNIFLOG,"a+"))){      /* Log to file */
  299.          if(verbosity){
  300. --- NumberOneCrush/prometheus.c    Thu May  8 15:37:03 1997
  301. +++ NumberOneCrush/prometheus.c    Fri Jun  6 01:33:17 1997
  302. @@ -1,7 +1,7 @@
  303.  /*
  304.   *
  305.   *                                  Juggernaut
  306. - *                                  Version b2
  307. + *                                  Version 1.2
  308.   *
  309.   *                            1996/7 Guild productions
  310.   *                           daemon9[guild|phrack|r00t]
  311. --- NumberOneCrush/surplus.c    Thu May  8 15:37:03 1997
  312. +++ NumberOneCrush/surplus.c    Fri Jun  6 01:33:03 1997
  313. @@ -1,7 +1,7 @@
  314.  /*
  315.   *
  316.   *                                  Juggernaut
  317. - *                                  Version b2
  318. + *                                  Version 1.2
  319.   *
  320.   *                            1996/7 Guild productions
  321.   *                           daemon9[guild|phrack|r00t]
  322. @@ -29,6 +29,7 @@
  323.  #define HELPFILE    "./ClothLikeGauze/.help"
  324.  #define FBUFSIZE     80
  325.  #define MINIBUF      10
  326. +#define DEVICE      "eth0"
  327.  
  328.  extern int verbosity;    
  329.  
  330. @@ -346,6 +347,7 @@
  331.  void cleanexit(){
  332.  
  333.      void powerdown();
  334. +    int tap(char *,int);
  335.  
  336.      extern int ripsock;
  337.      extern int hpid;
  338. @@ -353,6 +355,7 @@
  339.  
  340.      close(ripsock);
  341.      powerdown();
  342. +    tap(DEVICE,0);                          /* Unset promisc mode on the interface */
  343.      if(kill(hpid,SIGUSR1))if(verbosity){    /* Send signal to the hunter */
  344.          perror("(cleanexit) Could not signal hunter");
  345.          fprintf(stderr,"[cr]");
  346. <-->
  347.  
  348.  
  349.  
  350. ----[  EOF
  351.  
  352.